/*****************************************************
** Author:
** Date: 2019-11-04
*
*****************************************************/

#ifndef __SCRIPT_H_
#define __SCRIPT_H_

#ifdef __cplusplus
extern "C"{
#endif


#include "comm.h"

#define LUA_ARCH_MODULE_PWM_INIT_METHOD      "DNAPwmInit"
#define LUA_ARCH_MODULE_GPIO_INIT_METHOD     "DNAGpioInit"
#define LUA_ARCH_MODULE_UART_INIT_METHOD     "DNAUartInit"
#define LUA_ARCH_MODULE_DEVINFO_INIT_METHOD  "DNADevinfoInit"
#define LUA_ARCH_MODULE_CLOUDS_INIT_METHOD   "DNACloudsInit"
#define LUA_ARCH_MODULE_STARTUP_METHOD       "DNAStartup"
#define LUA_ARCH_MODULE_NETWORK_METHOD       "DNANetwork"
#define LUA_ARCH_MODULE_BINREQ_METHOD        "DNABinReq"
#define LUA_ARCH_MODULE_BIN2KV_METHOD        "DNABin2KV"
#define LUA_ARCH_MODULE_KV2BIN_METHOD        "DNAKV2Bin"

/*
 *  This is an integer parameter
 */
#define LUA_ARCH_MODULE_UART_ID              "id"
/*
 *  This is an integer parameter
 */
#define LUA_ARCH_MODULE_UART_BAUD           "baud"
/*
 *  This is an integer
 *  Options: 5/6/7/8
 */
#define LUA_ARCH_MODULE_UART_BITS           "bits"
/*
 *  This is string parameter
 *  Options: "none","odd","even","space"
 */
#define LUA_ARCH_MODULE_UART_PARITY         "parity"
/*
 *  This is a number parameter
 *  Options: 1/1.5/2
 */
#define LUA_ARCH_MODULE_UART_STOP           "stop"
/*
 *  This is an integer parameter
 */
#define LUA_ARCH_MODULE_UART_FIT             "fit"

#define LUA_ARCH_MODULE_DEVINFO_DEVTYPE      "devtype"
#define LUA_ARCH_MODULE_DEVINFO_NAME         "name"
#define LUA_ARCH_MODULE_DEVINFO_HOSTNAME     "hostname"
#define LUA_ARCH_MODULE_DEVINFO_PID          "pid"

#define LUA_ARCH_MODULE_CLOUDS_CLDS          "clds"
#define LUA_ARCH_MODULE_CLOUDS_KEYMAP        "keymap"


int lua_arch_gpio_init(lua_State *l);
int lua_arch_gpio_deinit(lua_State *l);
int lua_arch_uart_init(lua_State* l, struct lua_arch_uart *uart);
int lua_arch_uart_deinit(lua_State* l);
int lua_arch_devinfo_init(lua_State* l, struct lua_arch_devinfo *devinfo);
int lua_arch_clouds_init(lua_State* l, unsigned int *mask);
int lua_arch_startup(lua_State* l, int mode);
int lua_arch_network(lua_State* l, int status);
int lua_arch_bin2kv(lua_State* l, unsigned int cldid, \
                    unsigned char *binin, int bininlen, \
                    char *kvin, int kvinlen, \
                    char *snapshot, int snapmaxsize, \
                    char *kvout, int kvoutmaxsize);
int lua_arch_kv2bin(lua_State* l, int cloudid, \
                    char *kvin, int kvinlen, \
                    char *snapshot, int snapmaxsize, \
                    char *kvout, int kvoutmaxsize);


#ifdef __cplusplus
}
#endif

#endif /* __SCRIPT_H_ */

